package com.macrohard.admin.config;

import com.macrohard.admin.config.properties.FileProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@Configuration
public class WebConfig implements WebMvcConfigurer {

	@Resource
	private FileProperties fileProperties;
	/**
	 * 映射文件地址
	 * @param registry
	 */
	@Override
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		registry.addResourceHandler(fileProperties.getProfile()).addResourceLocations("file:"+ fileProperties.getPath());
	}
}
